class huiwen:
    def __init__(self,a):
        self.a=a;
    def select(self,num):
        for i in self.a:
            num.append(i);
    def judge(self,num1):
        for i in range(0,len(num1)//2):
            if(num1[i]!=num1[len(num1)-i-1]):
                return 0;
        return 1;
    def solution(self):
        num=[];
        num2=[];
        self.select(num);
        for i in range(0,len(num)):
            for j in range(i+1,len(num)):
                num1=[];
                for k in range(i,j):
                    num1.append(num[k]);
                    if(self.judge(num1)==1):
                        num2.append("".join(num1));
        if num2:
            longest_palindrome = max(num2, key=len)
            print(f"最长回文子串为：{longest_palindrome}")
        else:
            print("没有回文子串")

if __name__ == '__main__':
    a=input("请输入一串字符");
    b=huiwen(a);
    b.solution();













